#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
// /////// PARTE EN C+++
#include <iostream>
#include <fstream> 
#include <iomanip>
#include <vector>
#include <string>
#include "inc/healpix_base.h"
#include "inc/pointing.h"

//
using namespace std;
//
#define VERSION 0.1
//UNIDADES
#define C 300000 //Km/seg
#define Ho 100   // Km/seg/Mpc
//#define Z2R (300000/100)
#define Z2R 2997.82458
#define Z2V 299782.458
// tenemos entonces todo en unidades de h^(-1)

// FUnciones

/*inline*/ double max (double a, double b);
/*inline*/ double min (double a, double b);
long double fchiqui2 (char separador, FILE * arch);
void graf2 (char *NOM, int paso, int tot,int NN);
void grafica (char *NOM, int paso, int tot);
long double fchiqui (char separador, FILE * arch);
double angulito (double alfa0, double delta0, double alfa1, double delta1);
double angul (double alfa0, double delta0, double alfa1, double delta1);
double angul_z_f(double theta, double phi, double theta1,double phi1);
double angul_point(pointing A, pointing B);
double align_point(pointing A, double dis,double ap,pointing B);

int leemos(string n_dat,vector<double> &Z_out,vector<pointing> &point,vector<double> &marc_out,vector<int> *fin);


double dist(double A[3],double B[3]);

struct hist_type{
	float *dat;
	int Ndat;
	float max,min;
	float delta;
};


hist_type hist(float *ptr, int MAX_PTR, float lng[2]/*min, max*/,float delta);

struct uni_type{
	int binz;
	float *Z; // z
	float *R; // Mpc
};

uni_type universo(float omega_m,float omega_l,float Zmax,int iter=1000);

double rr(uni_type uni,float z);
